<section class="comlist">
	<script type = "text/javascript"   src = "/lib/syntaxhighlighter/scripts/shCore.js" > </script >   
	<script type = "text/javascript"   src = "/lib/syntaxhighlighter/scripts/shBrushes.js" ></script >
	<script type= "text/javascript" >  
		SyntaxHighlighter.config.clipboardSwf= '/lib/syntaxhighlighter/scripts/clipboard.swf'; 
		SyntaxHighlighter.all();
		SyntaxHighlighter.config.strings.viewSource = "查看代码";
		SyntaxHighlighter.config.strings.copyToClipboard = "复制代码";
		SyntaxHighlighter.config.strings.copyToClipboardConfirmation = "代码已复制到剪贴板上";
		SyntaxHighlighter.config.strings.print = "打印";
		SyntaxHighlighter.config.strings.help = "帮助";
		SyntaxHighlighter.config.strings.alert = "操作小贴士:\n\n";
	</script>
	<nav>选择查看相关的加评论： <a href="<?php echo '/'.BLOGGER_NAME.'/blogger/comartlist'?>">我文章的评论</a> | <a href="<?php echo '/'.BLOGGER_NAME.'/blogger/comlist'?>">我发表的评论</a></nav>
	<table>
		<thead>
		   <tr>
		   		<th class="title" width="400px">标题</th>
		   		<th width="200px">作者</th>
		   		<th width="278px">评论时间</th>
		   		<th width="100px" class="del">操作</th>
		   </tr>
		  </thead>
	 	<tbody>
<?php if(count($this->data)):?>
	<?php foreach($this->data as $comment):?>
		<tr class="list_item">
			<td class="title"><h3><?php echo $comment['title'];?></h3></td>
			<td><?php echo $comment['nickname'];?></td>
			<td><?php echo $comment['post_time'];?></td>
			<td class="del"><a href="<?php echo '/'.BLOGGER_NAME.'/blogger/comdel'.'/id/'.$comment['id']; ?>">删除</a></td>
		</tr>
		<?php if(!empty($comment['replywho'])):?>
		<tr><td class="reply_who" colspan="4"><small><?php echo $comment['commenter']." 回复： ".$comment['replywho'];?></small></td></tr>
		<?php else:?>
		<tr><td class="reply_who" colspan="4"><small><?php echo $comment['commenter']." 说： "?></small></td></tr>
		<?php endif;?>
		<tr><td class="reply" colspan="4"><?php echo $comment['content'];?></td></tr>
	<?php endforeach;?>
	<tr><td colspan="4">
	<?php  
		echo $this->paginationControl($this->data, 'Sliding',  'paginator/pagelist.phtml');  
	?>
	</td></tr>
<?php else: ?>
  <tr><td colspan="4"><h1>暂且没有任何评论！</h1></td></tr>
<?php endif;?>
		</tbody>
	</table>
	<?php
		$this->headLink()->prependStylesheet('/lib/jquery-ui/development-bundle/themes/base/jquery.ui.all.css');	//echo $this->headLink();
	?>
<script type="text/javascript" src="/lib/jquery-ui/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
		function stopDefault( e ) {
			 if ( e && e.preventDefault ){
				 e.preventDefault();
			 }else{
			  	window.event.returnValue = false;
			 	return false;
			 }
		}
	//当页面加载完毕时添加一个隐藏的div
	$(function(){
	   var boardDiv = "<div id='message' style='display:none;'><span id='spanmessage'></span></div>";
	   $(document.body).append(boardDiv);
	  
	});
	//只是提示信息alert
	   function message(text) {
	       $("#spanmessage").text(text);
	       $("#message").dialog({
	           title:"温馨提示",
	           modal: true,
	           buttons: {
	               "确定": function() {
	                   $(this).dialog("close");
	               }
	           }
	       });
	   }
	   //类似于confirm的功能
	   //说明callback是如果要选择是，要执行的方法
	   function queren(text, callback) {
	       $("#spanmessage").text(text);
	       $("#message").dialog({
	           title: "温馨提示",
	           modal: true,
	           resizable: false,
	           buttons: {
	               "否": function() {
	                   $(this).dialog("close");
	               },
	               "是": function() {
	                   callback.call();//方法回调
	                   $(this).dialog("close");
	               }
	           }
	       });
	   } 
	   $(".comlist .del a").click(function(event) {
	      stopDefault(event);  //阻止浏览器默认行为
	       var domElem = this;
	       var url = $(this).attr("href");
           queren("确认要永久删除这篇文章吗？", function() {
        	   $.get(url,{ajax:'1'},function(data) { 
                  if (data >=1) {
                	  var domParent = $(domElem).parent().parent();
                	  var domNext = domParent.next();
                	  var domNextNext = domNext.next();
                	  domParent.remove();
                	  domNext.remove();
                	  if(!domNextNext.is('.list_item')){
							domNextNext.remove();
                      }
                      message("删除成功！");
                   }else{
					  message("系统出错，请稍后再试！");
                   }
               }); 
                 	
           });
       });
	</script>
</section>